package Toolkit;

import net.sf.json.JSONObject;

public class ReturnObj {
    public String message = "";
    public int code = 200;
    public String dataOfString = "";
    public String  dataOfJson = "";

    public ReturnObj(String data)
    {
        JSONObject jd = JSONObject.fromObject(data);

        if (jd.containsKey("code") == false)
        {
            throw new RuntimeException("err@返回的数据不符合预期的格式:" + data);
        }

        this.message = jd.getString("message").toString();
        this.code = jd.getInt("code");
        this.dataOfString = jd.getString("data").toString();
        this.dataOfJson = jd.getString("data");
    }
}